package cz.vutbr.feec.utko.mtin.regression;

import cz.vutbr.feec.utko.ef.individuals.ActionTree;

public class DivisionAction extends ActionTree {

	private static final long serialVersionUID = 1533194189018768082L;

	@Override
	public String getSymbol() {
		return "/";
	}

	@Override
	public Object getValue(Object... operands) {
		assert operands.length == 2;
		Double o1 = (Double) operands[0];
		Double o2 = (Double) operands[1];

		Double d;

		try {
			d = o1 / o2;
		} catch (ArithmeticException e) {
			throw new ArithmeticException();
		}
		return d;
	}

}
